package com.decent.ejfadmin.order.dao;

import com.decent.ejfadmin.order.dao.provider.TrySellBatchDaoProvider;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/**
 * describe:慢充批次sql管理
 *
 * @author 陈豆豆
 * @date 2019/09/07
 */
@Mapper
@Repository("TrySellBatchDao")
public interface TrySellBatchDao {

    /**
     * 批次试充完毕,移除
     *
     * @param productType 运营商类型
     * @param batchId     批次号
     */

    @DeleteProvider(type = TrySellBatchDaoProvider.class, method = "remove")
    void remove(@Param("batchId") String batchId, @Param("productType") Integer productType);

    /**
     * 更新慢充批次号
     *
     * @param batchId 批次号
     */
    @Insert({"insert into yuhuang_try_sell_batch (batchId,productType) VALUES (#{batchId},#{productType})" +
            " ON DUPLICATE key update batchId=#{batchId},productType=#{productType}"})
    void merge(@Param("batchId") String batchId, @Param("productType") Integer productType);

    /**
     * 查询慢充批次是否存在
     *
     * @param batchId 批次号
     * @return 批次
     */
    @SelectProvider(type = TrySellBatchDaoProvider.class, method = "queryBatch")
    int queryBatch(@Param("batchId") String batchId, @Param("productType") Integer productType);

}
